<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<Ditto.Models.LocationDetail>" %>
<script src="http://dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=6.2" type="text/javascript"></script>
<script src="/Scripts/Ditto.js" type="text/javascript"></script>
    <div id="theMap" style="width: 520px">
    </div>
    <script type="text/javascript">
//<![CDATA[   
    $(document).ready(function() {
        var latitude = <%: Convert.ToString(Model.Latitude, CultureInfo.InvariantCulture) %>;
        var longitude = <%: Convert.ToString(Model.Longitude, CultureInfo.InvariantCulture) %>;
                
        if ((latitude == 0) || (longitude == 0))
            Ditto.LoadMap();
        else
            Ditto.LoadMap(latitude, longitude, mapLoaded);
    });
      
    function mapLoaded() {
        var title = "<%: Model.Title %>";
        var address = "<%: Model.Address %>";
    
        Ditto.LoadPin(Ditto._map.GetCenter(), title, address);
        Ditto._map.SetZoomLevel(14);
    } 
//]]>
    </script>
    (drag the pin in the map if it doesn't look right) *
